package com.yzh.openai.types.exception;

import com.yzh.openai.types.common.Constants;

/**
 * 自定义异常
 */
public class BusinessException extends RuntimeException {
    /**
     * 异常码
     */
    private final String code;
    /**
     * 异常信息
     */
    private String message;

    public BusinessException(Constants.ResponseCode code) {
        this.code = code.getCode();
    }

    public BusinessException(Constants.ResponseCode code, String message) {
        this.code = code.getCode();
        this.message = message;
    }

    public BusinessException(Constants.ResponseCode code, String message, Throwable cause) {
        this.code = code.getCode();
        this.message = message;
        super.initCause(cause);
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }


}
